package cn.kgc.springbootdemo.util;

import cn.kgc.springbootdemo.aop.StopFormRepeatSubmitInterceptor;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;


/**
 * <p>
 * Api接口幂等性(防止表单重复提交)Bean自动注入到spring容器中。其他模块使用
 * </p>
 *
 * @author 杨朝勇
 * @Version: V1.0
 * @since 2019-04-13 17:46
 */
@Configuration
@AllArgsConstructor
@ConditionalOnWebApplication
public class StopFormRepeatSubmitAutoConfig {


	@Bean
	public StopFormRepeatSubmitInterceptor extApiAopIdempotent(final RedisTemplate redisTemplate,final TokenUtil tokenUtil) {
		return new StopFormRepeatSubmitInterceptor(redisTemplate,tokenUtil);
	}

}
